﻿using System;
using DBServer.Selenium.Extenium.Path;
using Selenium;

namespace DBServer.Selenium.Extenium.Fixtures
{
    public abstract class DateFieldFixture<T> : TextFieldFixture <DateFieldFixture<T>>
        where T : DateFieldFixture<T>
    {
        protected DateFieldFixture(ISelenium driver, IPath path) 
            : base(driver, path) { }

        /*public override T SetText(string s)
        {
            return (T) this;
        }*/

        public T SetDate(int dd, int mm, int yyyy)
        {
            SafeExec(Path.Eval() + ".setValue('" + String.Format("{0:D2}", mm) + "" + String.Format("{0:D2}", dd) + "" + String.Format("{0:D4}", yyyy) + "');");
            return (T)this;
        }
    }

    public class DateFieldFixture : DateFieldFixture<DateFieldFixture>
    {
        public DateFieldFixture(ISelenium driver, IPath path) : base(driver, path) { }
    }
}
